package Linux五种IO模型;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author coderFu
 * @create 2022/3/5
 * 多线程的BIO模型
 */
public class MutlThreadBIOServer {

    public static void main(String[] args) throws IOException {

        ServerSocket serverSocket = new ServerSocket(9999);
        System.out.println("服务端的端口为："+serverSocket.getLocalSocketAddress());
        while (true){
            Socket accept = serverSocket.accept();
            // 丢入线程池中进行执行
            ThreadPoolExecutor threadPool = ThreadPoolConfig.getThreadPool();
            threadPool.execute(new ClientHandler(accept));
        }
    }


}
